package com.linln.modules.system.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linln.common.enums.StatusEnum;
import com.linln.common.utils.StatusUtil;
import com.linln.component.excel.annotation.Excel;
import com.linln.component.excel.enums.ExcelType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author 小懒虫
 * @date 2018/8/14
 */
@Data
@Entity
@Table(name = "pcs_company")
@ToString(exclude = {"dept", "roles"})
@EqualsAndHashCode(exclude = {"dept", "roles"})
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update pcs_company" + StatusUtil.SLICE_DELETE)
@Where(clause = StatusUtil.NOT_DELETE)
@Excel("公司数据")
public class Company implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Excel(value = "公司ID", type = ExcelType.EXPORT)
    private Long id;

    @Excel("公司名称")
    private String name;

    @Excel("信用代码")
    private String code;

    @Excel("电话")
    private String telphone;

    @Excel("法人名称")
    private String legalName;

    @Excel("法人手机号")
    private String legalPhone;

    @Excel("法人身份证号")
    private String legalCardNo;

    @Excel("营业执照")
    private String license;

    @Excel("简洁")
    private String content;

    @Excel("密码")
    private String password; // 新增字段

    @CreatedDate
    @Excel("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    @LastModifiedDate
    @Excel("更新时间")
    private Date updateTime;

    @JsonIgnore
    private Long createUser;

    @JsonIgnore
    private Long updateUser;

    @JsonIgnore
    private Byte status = StatusEnum.OK.getCode();
    private String addr;
    @Transient
    private Long porterNum;

    private Integer isWl;//是否为五类人员0否 1是


}
